package com.atguigu.crowd.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.atguigu.crowd.entity.Project;
import com.atguigu.crowd.mapper.ProjectMapper;
import com.atguigu.crowd.service.api.ProjectService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

@Service
public class ProjectServiceImpl implements ProjectService {

	@Autowired
	private ProjectMapper projectMapper;
	
	@Override
	public PageInfo<Project> getPageInfo(Integer pageNum, Integer pageSize, String keyword) {
		PageHelper.startPage(pageNum, pageSize);
		List<Project> list = projectMapper.selectProjectByKeyword(keyword);
		return new PageInfo<>(list);
	}

	@Override
	public Project getProject(Integer projectId) {
		Project project = projectMapper.selectByPrimaryKey(projectId);
		return project;
	}


}
